home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
etc
/
init.d
/
hostname
< prev
next >
Wrap
Text File
|
2006-04-25
|
945b
|
40 lines
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need checkroot
}
start() {
local myhost=$(/bin/hostname 2>/dev/null)
local retval=0
# If the hostname is already set via the kernel, and /etc/hostname
# isn't setup, then we shouldn't go reseting the configuration #38172.
if [[ -z ${myhost} ]] || [[ ${myhost} == "(none)" ]] ; then
myhost="localhost"
fi
if [[ -f /etc/hostname ]] ; then
ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname"
myhost=$(</etc/hostname)
else
myhost=${HOSTNAME}
fi
ebegin "Setting hostname to ${myhost}"
/bin/hostname "${myhost}"
retval=$?
eend ${retval} "Failed to set the hostname"
if [[ ${retval} -eq 0 ]] ; then
# setup $HOSTNAME, ignore errors in case /etc is readonly.
echo "HOSTNAME=\"${myhost}\"" 2>/dev/null > /etc/env.d/01hostname
fi
return ${retval}
}
# vim:ts=4